package com.garlic.face.jlf.transaction.shop;


import com.garlic.face.jlf.transaction.bean.GoodBean;

import java.util.ArrayList;

/**
 * Created by lyq on 2018/5/30.
 * Email: lyqcy1337@163.com
 * 存储购物信息类
 */

public class TradeInfo {

    public static final int BAG_SIZE_SMALL = 0;
    public static final int BAG_SIZE_MIDDLE = 1;
    public static final int BAG_SIZE_BIG = 2;

    private static TradeInfo mShopInfo = null;

    /**
     * 单例，保证唯一
     *
     * @return
     */
    public static TradeInfo getInstance() {
        if (null == mShopInfo) {
            synchronized (TradeInfo.class) {
                if (null == mShopInfo) {
                    mShopInfo = new TradeInfo();
                }
            }
        }
        return mShopInfo;
    }

    /**
     * 清除数据
     */
    public void clearShopData() {
        if (goodsList != null) {
            goodsList.clear();
        }
        totalPrice = "0.00";
        totalNumber = 0.00;
        price = "0.00";
        discount = "0.00";
        shopTotalPrice = "0.00";
        urlAddress = "";
    }

    private String price = "0.00"; // 总原价
    private String discount = "0.00"; // 总折扣
    private String totalPrice = "0.00"; // 需支付金额
    private String shopTotalPrice = "0.00"; // 购物界面总金额
    private Double totalNumber = 0.00;
    private ArrayList<GoodBean> goodsList = new ArrayList<>();
    private String urlAddress = ""; // 二维码URL
    private String[] bags = new String[]{"A6940712000124", "0", "A6940712000124"}; // 塑料袋barcode：0小；1中；2大

    public String getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(String totalPrice) {
        this.totalPrice = totalPrice;
    }

    public ArrayList<GoodBean> getGoodsList() {
        return goodsList;
    }

    public void setGoodsList(ArrayList<GoodBean> goodsList) {
        this.goodsList = goodsList;
    }

    public Double getTotalNumber() {
        return totalNumber;
    }

    public void setTotalNumber(Double totalNumber) {
        this.totalNumber = totalNumber;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getDiscount() {
        return discount;
    }

    public void setDiscount(String discount) {
        this.discount = discount;
    }

    public String getUrlAddress() {
        return urlAddress;
    }

    public void setUrlAddress(String urlAddress) {
        this.urlAddress = urlAddress;
    }

    public String[] getBags() {
        return bags;
    }

    public void setBags(String[] bags) {
        this.bags = bags;
    }

    public String getShopTotalPrice() {
        return shopTotalPrice;
    }

    public void setShopTotalPrice(String shopTotalPrice) {
        this.shopTotalPrice = shopTotalPrice;
    }
}
